import 'ol/ol.css';
import 'ol/ol.css'
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import { TileWMS } from 'ol/source';
import { fromLonLat } from 'ol/proj';


var map = new Map({
    layers: [
        // new TileLayer({
        //     source: new OSM()
        // }),
        new TileLayer({
            // source: new TileDebug()
            // extent: [-13884991, 2870341, -7455066, 6338219],
            source: new TileWMS({
                url: 'http://192.168.50.69:8080/geoserver/wms',
                params: {
                    'LAYERS': 'chinaMap:china_province',
                    // 'TILED': true
                },
                serverType: 'geoserver',
                transition: 0 //不透明度过渡的持续时间
            }),
            // opacity: 0.5  整个图层透明度
        }),
        new TileLayer({
            source: new TileWMS({
                url: 'http://192.168.50.69:8080/geoserver/wms',
                params: {
                    'LAYERS': 'chinaMap:china_9nashedline',
                    'TILED': true
                },
                serverType: 'geoserver',
                transition: 0
            })
        }),
        new TileLayer({
            source: new TileWMS({
                url: 'http://192.168.50.69:8080/geoserver/wms',
                params: {
                    'LAYERS': 'chinaMap:china_city', //  chinaMap:china_town_point chinaMap:china_city
                    'TILED': true
                },
                serverType: 'geoserver',
                transition: 0
            })
        }),
        new TileLayer({
            source: new TileWMS({
                url: 'http://192.168.50.69:8080/geoserver/wms',
                params: {
                    'LAYERS': 'china_town_point', //  chinaMap:china_town_point chinaMap:china_city
                    'TILED': true
                },
                serverType: 'geoserver',
                transition: 0
            })
        }),
        new TileLayer({
            source: new TileWMS({
                url: 'http://192.168.50.69:8080/geoserver/wms',
                params: {
                    'LAYERS': 'china_town_line', //  chinaMap:china_town_point chinaMap:china_city
                    'TILED': true
                },
                serverType: 'geoserver',
                transition: 0
            })
        })
    ],
    target: 'map',
    view: new View({
        center: fromLonLat([108.934, 34.2478]),
        zoom: 12
    })
});